home *** CD-ROM | disk | FTP | other *** search
/ Fritz: All Fritz / All Fritz.zip / All Fritz / FILES / PROGSCAL / TINYPASC.LZH / TU.GRM < prev    next >
Text File  |  1986-02-17  |  1KB  |  28 lines

  1.   \ TU.GRM  -- tiny Pascal grammar held to 25 productions
  2. Goal -> FDeclList
  3. FDeclList -> FDeclList FuncDecl ;
  4.           -> FuncDecl ;
  5. FuncDecl -> FUNCTION <identifier> ( ExprList ) ; Stmt  #FDECL
  6.          -> VAR ExprList      #VDECL   \ Global variables
  7.                \ ExprList must be identifiers only
  8. Stmt -> <identifier> := Expr   #ASSIGN
  9.      -> IF Expr THEN Stmt ELSE Stmt  #IFTHEN
  10.      -> WHILE Expr DO Stmt     #WHILEDO
  11.      -> BEGIN StmtList END     #BLOCK
  12.      -> Expr                   #SEXPR  \ procedure call only!
  13. StmtList -> StmtList Stmt ;    #STLIST2
  14.          -> <empty>
  15. Expr -> Expr + Term            #ADDOPR
  16.      -> Expr - Term            #SUBOPR
  17.      -> Term
  18. Term -> Term * Primary         #MPYOPR
  19.      -> Term / Primary         #DIVOPR
  20.      -> Primary
  21. Primary -> ( Expr )            #PAREN
  22.         -> <integer>          \ only type INTEGER supported
  23.         -> <string>
  24.         -> <identifier>       \ variable or function call w/o parameters
  25.         -> <identifier> ( ExprList )      #FUNCP
  26. ExprList -> ExprList , Expr    #EXPRLIST2
  27.          -> Expr               #EXPRLIST1
  28.